Nothing will be printed on the screen.
The variable
NAM$ is seen
for the first time in the PRINT
statement:
LET NAME$ = "Professor Moriarty" PRINT NAM$ END
It starts out empty, like all string variables.
So the PRINT
statement has no characters to print.
String variables contain strings of characters.
The characters can be any printable character on the keyboard,
including spaces and punctuation
(but not function keys, the enter key, and some others.)
In a LET
statement you show what characters you want
in the string by starting with a quote ( " ) then typing in
whatever you want, then ending with a quote ( " ) .
The quote marks will not be part of the string stored in memory.
Space is a character.
It takes up as much memory as any other character.
Here is a program that puts a long string into the
variable NAME$
.
LET NAME$ = "Dr. John H. Watson, M.D." PRINT NAME$ END
All the characters between the first and last " are
put into NAME$
.
The spaces, comma, periods, and upper and lower case
letters are copied to the variable exactly as in the
LET statement.
A string can have very many characters in it. There is a limit to how big it can be, but you won't need to worry about that.
How many characters are in the following string? (Remember that the quote marks are not part of the string.)
"A B C D "